<?php
namespace Admin\Controller;
use Think\Controller;
/**
 * 后台首页控制器
 */
class IndexController extends CommonController {
	/**
	 * 后台首页视图
	 * @return [type] [description]
	 */
    public function index(){
        $this->display();
    }
    /**
     * 退出登录
     */
    public function logout(){
    	session_unset();
    	session_destroy();
    	redirect(U('Admin/Login/index'));
    }
    public function copy(){
        $this->blog = M('blog')->count();
        $this->talk = M('talk')->count();
        $this->display();
    }
    /**
     * 清理缓存
     */
    public function cache(){
        $pc = HTML_PATH.'pc/';
        $mobile = HTML_PATH.'mobile/';
        if( delete_files($pc.I('get.type')) && delete_files(CACHE_PATH.'Index/') && delete_files($mobile.I('get.type')) && delete_files(CACHE_PATH.'Mobile/')){
            $this->success("清除缓存成功!",U('copy'));
        }else{
            $this->error('清除缓存失败');
        }
    }
}